﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebShop.DataService;
using WebShop.Classes;

namespace WebShop.Models
{
    /// <summary>
    /// Model for cart
    /// </summary>
    public class CartModel : BaseModel
    {
        /// <summary>
        /// Car order
        /// </summary>
        public OrderFull Order
        { 
            get {
                return ConfigStorage.Order;
            } 
        }

        /// <summary>
        /// Total cost of cart
        /// </summary>
        public decimal TotalPrice
        {
            get
            {
                decimal result = 0;

                foreach (OrderPosition item in Order.Composition)
                {
                    result += item.Cost * item.Count;
                }

                return result;
            }
        }
    }
}